import React, { useEffect } from "react";
import { useRoutes } from "react-router-dom";
import "./App.scss";
import router from "./router";
import { useNavigate } from "react-router-dom";
import eventBus from "@/util/event";

function App() {
  const elementRouters = useRoutes(router);
  const navigate = useNavigate();
  useEffect(() => {
    // 重新登录
    eventBus.on("login-again", () => {
      navigate("/login");
    });
  }, []);
  return (
    <div className="App">
      {elementRouters}
      {/* <Routes>
        <Route element={<Login />} path="/login"></Route>
        <Route element={<Layout />}>
          <Route element={<Home />} path="/home"></Route>
        </Route>
      </Routes> */}
    </div>
  );
}

export default App;
